#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
@Project ：cross_gameserver 
@File    ：cross_shop.py
@IDE     ：PyCharm 
@Author  ：ZhongZhaopai
@Date    ：2021/8/24 11:49 
'''
from pyshare.const.enums.cross_activity import CrossShopType
from pyshare.game_logs.cross_fight_log import CrossFightShopCommonScoreLog, CrossFightShopSeniorScoreLog


class CrossShopRoleMiXin(object):

    role_guid = NotImplemented
    score_stat = NotImplemented

    def shop_score_value_log(self, val):
        """
        商城货币值日志
        :param val: 威望值数值
        :return:
        """
        try:
            score_type_list = [str(CrossShopType.Common), str(CrossShopType.Senior)]
            for score_type in score_type_list:
                new_val = val.get(score_type, 0)
                old_val = self.score_stat.get(score_type, 0)
                add_shop_score_value = new_val - old_val
                if add_shop_score_value == 0:
                    continue
                if score_type == str(CrossShopType.Common):
                    try:
                        CrossFightShopCommonScoreLog.log_game(self.role_guid, new_val, add_shop_score_value)
                    except:
                        pass
                else:
                    try:
                        CrossFightShopSeniorScoreLog.log_game(self.role_guid, new_val, add_shop_score_value)
                    except:
                        pass
        except:
            pass
